﻿using ProjectScheduling_web.model;

namespace ProjectScheduling_web.dao
{
    public class CustomerDao : BaseDao<Customer>
    {
        public static CustomerDao Base = new CustomerDao();
        public List<IdName> SearchNameByKey(string key)
        {
            return Db.Queryable<Customer>()
                .Where(it => (string.IsNullOrEmpty(key) || (it.Name != null && it.Name.Contains(key))))
                .Select(it => new IdName { Id = it.Id, Name = it.Name ?? "" })
                .Take(20)
                .ToList();
        }
    }
}
